from django.http import JsonResponse
from utils.cos import upload


def file_test(request):
    try:
        photo = request.FILES.get('file')
        print(photo)
        upload(photo,  photo.name)
        print('图片上传成功')
        return JsonResponse({'msg': '公告发布成功'}, status=200)
    except Exception as e:
        print(e)
        return JsonResponse({'msg': '发布失败,您的输入不合理'}, status=400)
